<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="org.owasp.esapi.ESAPI"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
	<head>
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
		<title>统一登录平台</title>
			<!-- css import -->
			<link rel="stylesheet" href="${ctx}/common/adminlte/plugins/bootstrap/css/bootstrap.min.css">
			<link rel="stylesheet" href="${ctx}/css/font-awesome.min.css">
			<link rel="stylesheet" href="${ctx}/css/ionicons.min.css">
			<link rel="stylesheet" href="${ctx}/common/adminlte/dist/css/AdminLTE.min.css">
			<link rel="stylesheet" href="${ctx}/common/adminlte/plugins/iCheck/flat/blue.css">
			<!-- js import -->
			<script src="${ctx}/common/adminlte/plugins/jQuery/jQuery-2.2.0.min.js"></script>
			<script src="${ctx}/common/adminlte/plugins/bootstrap/js/bootstrap.min.js"></script>
			<!-- iCheck -->
			<script src="${ctx}/common/adminlte/plugins/iCheck/icheck.min.js"></script>
			<script type="text/javascript" src="${ctx}/js/jquery-md5-min.js"></script>
			<script type="text/javascript" src="${ctx}/common/adminlte/dist/js/pptBox.js"></script>
			<style type="text/css">
        .frame {
            height: 49px;
            margin: 0;
            padding: 0;
            border-bottom: 1px solid #ddd;
        }
        .frame a {
            color: #666;
        }
        .frame a:hover {
            color: #222;
        }
        .frame .buttons a {
            height: 49px;
            line-height: 49px;
            display: inline-block;
            text-align: center;
            width: 50px;
            border-left: 1px solid #ddd;
        }
        .frame .brand {
            color: #444;
            font-size: 20px;
            line-height: 49px;
            display: inline-block;
            padding-left: 10px;
        }
        .frame .brand small {
            font-size: 14px;
        }
	</style>
	</head>
	<script type="text/javascript">
		//解决ie不支持trim
		$(document).ready(
	           function(){
	                 if(!String.prototype.trim) {
	                     String.prototype.trim = function () {
	                          return this.replace(/^\s+|\s+$/g,'');
	                     };
	               }
	           }
	      );
	    //回车登录
		document.onkeydown=function mykeyDown(e){  
		      //compatible IE and firefox because there is not event in firefox  
		       e = e||event;  
		       if(e.keyCode == 13) {sumbit();}   
		       return;  
		};
		//登录操作
		function sumbit(){
			var uname = $('#userEname').val();
			var upass = $('#upass').val();
			if(uname==null|| uname==""){
				setErrMsg('请输入用户名');
				$('#userEname').focus();
				return;
			}
			if(upass==null|| upass==""){
				setErrMsg('请输入密码');
				$('#upass').focus();
				return;
			}
			$("#userPass").val(upass.md5());
			//数据提交
			$.ajax({
				url:'${ctx}/passport/login/login.action',
				type:'post',
				data: $("#inputForm").serialize(),
				success:function(data){
					var jdata = jQuery.parseJSON(data);
					if (jdata.flag == 'T') {
						//使用此种方式防止外部系统登录无法跨域访问
						var url = jdata.msg;
						window.location.href=url;
					} else {
						setErrMsg(jdata.msg);
						clearForm();
					}
				},error:function(data){
					setErrMsg('与服务器连接失败');
				}
			});
		}
		
		//清空表单数据
		function clearForm(){
			$("#upass").val("");
			$("#userEname").val("");
		}
		
		function setErrMsg(msg){
			$("#error-message").html("<font color='red'>"+msg+"</font>");
		}
	</script>
<style>
*{padding:0;margin:0;}
.login_title{color:#52aacf;font-size:30px;}
.login_title p{display:inline-block;padding-right:10px;border-right:3px solid #52aacf;}
.login_title span{display:inline-block;font-size:14px;color:#464849;padding-left:10px;}
.login_wrap{background:#53abd0;height:400px;}
.login-box{height:325px;background:#fff;box-shadow:0 1px 1px #ddd;}
.login-box h6{text-align:center;font-weight:bold;font-size:18px;color:#214349;padding:30px 0;}
#inputForm{padding:0 30px;}
#inputForm .form-group:last-child{margin-top:25px;}
.login_btn{margin:30px 15px 0 15px;border-top:1px solid #ddd;color:#a5a8aa;padding:20px 15px 0 15px}
.login_btn a{color:#a5a8aa}
.login_btn button{background:#4fc3eb;color:#fff;border-radius:5px;}
.form-control-feedback{left:0;top:7px;color:#aaaaaa;}
.has-feedback .form-control{color:#aaaaaa;height:45px;line-height:45px;padding:10px 0 10px 30px;}
.form-control:focus{border:1px solid #88a8c1;box-shadow:2px 2px 5px rgba(136,168,193,.5);}
.footer{color:#969696;margin:10px 0;}
</style>
<body class="">
<div class="container">
  <h1 class="login_title"><p>统一登录 管理后台</p> <span>欢迎登录！</span></h1>
</div>
<div class="login_wrap">
   <div class="container">
      <div class="row">
         <div class="col-md-6"><img src="images/login_bg.png"/></div>
         <div class="col-md-1"></div>
         <div class="col-md-4">
         <!-- login start -->
             <!-- /.login-logo -->
  <div class="login-box">
    <h6>登录信息</h6>
    <form action="" method="post" id="inputForm" name="inputForm">
         <input type="hidden" name="go" value="<%=ESAPI.encoder().encodeForHTML(request.getParameter("go")) %>" />
		 <input type="hidden" name="cset" value="<%=ESAPI.encoder().encodeForHTML(request.getParameter("cset")) %>" />
		 <input type="hidden" name="sys" value="<%=ESAPI.encoder().encodeForHTML(request.getParameter("sys")) %>" />
		 <input type="hidden" name="_client" value="<%=ESAPI.encoder().encodeForHTML(request.getParameter("_client")) %>" />
		 <input id="userPass" name="userPass" type="hidden"/>
      <div class="form-group has-feedback">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
        <input id="userEname" name="userEname" class="form-control" tabindex="1" placeholder="输入用户名" type="text" value=""/>
      </div>
       <div class="form-group has-feedback">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
        <input type="password" id="upass" class="form-control" placeholder="输入密码" value="">
      </div>
    </form>
   
    <div class="login_btn">
      <div class="row">
       <!--  <div class="col-xs-8">
           <a href="${ctx}/passport/reg/passport-mn.action" tabindex="4">忘记密码?</a> |
           <a href="${ctx}/passport/reg/passport-reg.action" class="text-center">注册</a> 
        </div>
         -->
        <div class="col-xs-12">
          <button type="button" class="btn btn-block" onclick="sumbit()">登   录</button>
        </div>
        <div class="col-xs-12" id="error-message"></div>
      </div>
  </div>
  <!-- /.login-box-body -->
         <!-- login end -->
         
         
         
         
         
         
         
         
         </div>
      </div>
   </div>
</div>












<footer class="footer">
   <center>Copyright © 2014 - 2019 dwusoft, Inc. All rights reserved. Powered by <a href="http://www.dwusoft.com/" target="_blank">dwusoft Central Authentication Service 1.0.0</a> 
  版权所有<br>
 推荐使用IE9及以上浏览器浏览.目前支持IE9,360浏览器,FireFox,GoogleChrome </center> 
</footer>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '10%' // optional
    });
  });
</script>
</body>
</html>